package com.symbio.ishenapi.doctor.controller;

import com.symbio.ishenapi.common.controller.BaseController;
import com.symbio.ishenapi.doctor.model.TmDoctorVisits;
import io.jboot.web.controller.annotation.RequestMapping;

import java.util.Map;

/**
 * @Author: chen
 * @Description:
 * @Date: Created in 17:15 2018/10/28
 * @Modified By:
 */
@RequestMapping("/TmDoctorVisits")
public class TmDoctorVisitsController extends BaseController {


    /**
     * 出诊表列表分页查询
     */
    public void findList(){

        String doctorId = getPara("doctorId");
        Map map = TmDoctorVisits.dao.findList(getQueryModel(),doctorId);
        renderPageJsonRet(map.get("count"),map.get("data"));
    }

    /**
     * 出诊列表逻辑删除
     */
    public void delete(){

        int id = getParaToInt("id");
        if(TmDoctorVisits.dao.updateStatus(id) > 0){
            renderJsonError(40001,"出诊删除");
        }else {
            renderJsonError(40002,"出诊删除");

        }
    }

    /**
     * 出诊信息保存
     */
    public void save(){
        try {
            TmDoctorVisits tmDoctorVisits = (TmDoctorVisits)getReqBodyObject(TmDoctorVisits.class);
            TmDoctorVisits.dao.saveDoctorVisits(tmDoctorVisits);
            renderJsonError(50001,"出诊保存");
        }catch (Exception ex){
            renderJsonError(50002,"出诊保存");
        }
    }

}
